ComputedStyle = function(element,value){
	if(typeof element == 'string')
		element=document.getElementById(element);
		
	if(element.currentStyle)
		return element.currentStyle[value]
	else if(window.getComputedStyle)
		return document.defaultView.getComputedStyle(element,null).getPropertyValue(value);
}
/* From prototype.js */
if (!document.getElementsByClassName) {
	document.getElementsByClassName = function(className) {
		var children = document.getElementsByTagName('*') || document.all;
		var elements = new Array();
	  
		for (var i = 0; i < children.length; i++) {
			var child = children[i];
			var classNames = child.className.split(' ');
			for (var j = 0; j < classNames.length; j++) {
				if (classNames[j] == className) {
					elements.push(child);
					break;
				}
			}
		}
		return elements;
	}
}
var
IE  = navigator.userAgent.indexOf('MSIE') != -1,
IE6 = navigator.userAgent.indexOf('MSIE 6') != -1,
IE7 = navigator.userAgent.indexOf('MSIE 7') != -1,
IE8 = navigator.userAgent.indexOf('MSIE 8') != -1;
var timer = {
	t:0,
	start:function (){
		d = (new Date);
		timer.t = d.getTime();
	},
	end:function (){
		d = (new Date);
		return d.getTime()-timer.t;
	}
}
var el = function(e){
	this.version=0.4;
	this.by="Michael Markie";
	this.developing=false;
	this.unsupportedBrowsers = ['SymbianOS','iPhone','iPod'];
	
	//Detect which method of elements that are used for example ID, Class, Tag Name or a Object.
	if(typeof e == "string"){
		// # defines a element ID
		if(e.substring(0,1) == "#" && document.getElementById(e.replace('#','')))
			this.e = document.getElementById(e.replace('#',''));
		// . defines a element Class
		else if(e.substring(0,1) == '.' && document.getElementsByClassName(e.replace('.','')))
			this.e = document.getElementsByClassName(e.replace('.',''));
		// No alphanumerics defines a Element Tag name, resulting in a array.
		else if(document.getElementsByTagName(e))
			this.e = document.getElementsByTagName(e);
	}else if(typeof e == "object"){
		this.e=e;
	}
	
	this.css = function(property,value){
		if(this.e == "[object NodeList]" || this.e == "[object HTMLCollection]" || this.e.length >= 1){
			//If it is a array list loop through the elements and change the CSS values.
			for(var i in this.e){
				//if the style exists change the css property by passing it through the el library again which allows the cross browser CSS to kick in.
				if(this.e[i] && this.e[i].style)
					el(this.e[i]).css(property,value);
			}
		}else{
			//Cross Browser Compatibility Begin.
			//Mostly used to support old browser versions and internet explorer.
			if(property == "opacity"){
				if(IE){
					this.e.style['filter']="alpha(opacity="+(value*100)+")";
					//zoom is used because of a bug when using filter in certain areas would not work.
					this.e.style['zoom']=1;
				}
				this.e.style['-moz-opacity']=value;
				this.e.style['-khtml-opacity']=value;
			}
			if(property == "text-overflow"){
				this.e.style['-o-text-overflow']=value;
			}
			//Cross Browser Compatibility End.
			
			this.e.style[property] = value;
		}
		return this;
	};
	this.addClass = function(cls){
		this.e.className+=" "+cls;
		return this;
	};
	this.removeClass = function(cls){
		this.e.className=this.e.className.replace(RegExp('(\\s|^)'+cls+'(\\s|$)'),' ');
		return this;
	};
	this.append = function(text){
		this.e.innerHTML+=text;
		return this;
	};
	this.content = function(text){
		this.e.innerHTML=text;
		return this;
	};
	this.createElement = function(ele){
		var cElement = document.createElement(ele);
		if(this.e == "[object NodeList]" || this.e == "[object HTMLCollection]" || this.e.length >= 1){
			for(var i in this.e){
				if(typeof this.e[i] == "object")
					this.e[i].appendChild(cElement);
			}
		}else{
			this.e.appendChild(cElement);
		}
		
		this.e = cElement;
		cElement=null;
		return this;
	};
	this.childElement = function(){
		if(this.e.children[0])
			this.e = this.e.children[0];
		return this;
	};
	this.setAttribute = function(name,value){
		this.e.setAttribute(name,value);
		return this;
	};
	this.parentElement = function(){
		if(this.e.parentNode)
			this.e = this.e.parentNode;
		return this;
	};
	this.ajax = function(v){
		timer.start();
		var xhr = window.XMLHttpRequest?new XMLHttpRequest():new ActiveXObject("Microsoft.XMLHTTP"),
		e = this.e;
		if(xhr){
			xhr.onreadystatechange = function(){
				if(xhr.readyState != 4){
					if(typeof v.loading == "function")
						v.loading();
				}else{
					if(v.format == "xml"){
						var xmlDoc = xhr.responseXML;
					}else{
						if(v.overwrite)
							e.innerHTML=xhr.responseText;
						else
							e.innerHTML+=xhr.responseText;
					}
					
					if(typeof v.complete == "function"){
						v.complete(timer.end(),xmlDoc);
						e=null,xhr=null;
					}
				}
			}
			xhr.open("GET",v.url,true); 
			xhr.send(null);
		}
		return this;
	};
	this.lightbox = function(v){
		//automate the lightbox by providing the overlay and input box
		if(v.setup == "auto"){
			this.e = document.body;
			var lbox = '<div id="elLightbox"></div>';
			this.e.innerHTML=lbox + this.e.innerHTML;
		}
		return this;
	};
	this.animate = function(v){
		if(this.e.style[v.property]){
			timer.start();
			var px = this.e.style[v.property].match('px'),
			start = parseInt(this.e.style[v.property].replace('px','')),
			e = this.e;
			if(start<v.to){
				var animate = setInterval(function(){
					if(start<v.to){
						el(e).css(v.property,start+px)
						start=start+v.jump;
					}else{
						clearInterval(animate);
						el(e).css(v.property,v.to+px);
						if(typeof v.completed == "function")
							v.completed(e,timer.end());
						px=null,start=null,e=null;
					}
				},(IE)?3:20);
			}else if(start>v.to){
				var animate = setInterval(function(){
					if(start>v.to){
						el(e).css(v.property,start+px)
						start=start-v.jump;
					}else{
						clearInterval(animate);
						el(e).css(v.property,v.to+px);
						if(typeof v.completed == "function")
							v.completed(e,timer.end());
						px=null,start=null,e=null;
					}
				},(IE)?3:20);
			}
		}
		return this;
	};
	this.PNGfix = function(){
		// Correctly handle PNG transparency in Win IE 5.5 & 6. http://homepage.ntlworld.com/bobosola. Updated 18-Jan-2006.
		// Not working
		var arVersion = navigator.appVersion.split("MSIE")
		var version = parseFloat(arVersion[1])
		
		if((version >= 5.5) && (document.body.filters)){
			for(var i=0; i<document.images.length; i++){
				var img = document.images[i],
				imgName = img.src.toUpperCase();
				if(imgName.substring(imgName.length-3, imgName.length) == "PNG"){
					var imgID = (img.id)?"id='"+img.id+"' " : "",
					imgClass  = (img.className)?"class='"+img.className+"' " : "",
					imgTitle  = (img.title)?"title='"+img.title+"' ":"title='"+img.alt+"' ",
					imgStyle  = img.style.cssText+"display:inline-block;";
					
					if(img.align == "left")
						imgStyle = "float:left;"+imgStyle;
					if(img.align == "right")
						imgStyle = "float:right;"+imgStyle;
					if(img.parentElement.href)
						imgStyle = "cursor:hand;"+imgStyle;
					
					var strNewHTML = "<span "+imgID+imgClass+imgTitle+" style=\"width:"+img.width+"px;"
					+"height:"+img.height+"px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+img.src+"', sizingMethod='scale');"+imgStyle+"\"></span>";
					img.outerHTML = strNewHTML;
					i = i-1;
				}
			}
		}
	};
	this.ready = function(func){
		var oldonload = window.onload;
		if(typeof window.onload != "function"){
			window.onload = func;
		}else{
			window.onload = function(){
				oldonload();
				func();
			}
		}
	};
	
	
	if(this instanceof el)
		return this.el;
	else
		return new el(e);
}